import {Injectable} from '@nestjs/common';
import {CreateServerTypeDto} from './dto/create-server-type.dto';
import {UpdateServerTypeDto} from './dto/update-server-type.dto';
import {PrismaService} from "../prisma/prisma.service";
import {serverType} from "@prisma/client";

@Injectable()
export class ServerTypeService {
    constructor(private prisma: PrismaService) {
    }

    create(createServerTypeDto: CreateServerTypeDto) {
        return this.prisma.serverType.create({data: createServerTypeDto});
    }

    findAll(): Promise<serverType[]> {
        return this.prisma.serverType.findMany();
    }

    findOne(id: string) {
        return this.prisma.serverType.findUnique({where: {id}});
    }

    update(id: string, updateServerTypeDto: UpdateServerTypeDto) {
        return this.prisma.serverType.update({
            where: {id},
            data: updateServerTypeDto
        })
    }

    remove(id: string) {
        return this.prisma.serverType.delete({where: {id}});
    }
}
